extention={};
extention.config=[];

extention.config["jquery.validate.ajaxform"] = {
	submitHandler:function(form){
		window.app.loading.open();
		$(form).ajaxSubmit({
			error:function(response){
				window.app.loading.close();
				window.app.dialog.error("请求失败，系统异常！");
			},
			success:function(response){
				window.app.loading.close();
				if(response.code=="-1"){
					window.app.dialog.error(response.msg);
					return;
				}
				window.app.dialog.success(response.msg,function(){
					//跳转页面（如登录）
					if(response.toUrl!==null){
						new Form({
							action:response.toUrl,
							method:"GET",
						}).submit();
						return;
					}
					//跳转页面（表单数据提交）
					if(response.form!==null){
						new Form({
							action:response.form.action,
							method:response.form.method,
							data:response.data
						}).submit();
						return;
					}
					//用于管理页面
					window.top.$("#J_form").submit();
				});
			}
		});
	}
};
extention.config["jquery.validate.qtip"] = {
		onkeyup:false,
		success:function(label,element){
			$(element).qtip('destroy');
		},
		errorPlacement:function(error, element){
			$(element).qtip({
				content:error,
				show:{
					event:false,
					ready:true
				},
				hide:{
					event:false,
					fixed: true
				},
				position:{
					my:"left center",
					at:"right center"
				}
			});
		}
		
};
extention.config["jquery.validate"] = $.extend({},extention.config["jquery.validate.qtip"],extention.config["jquery.validate.ajaxform"]);
